package com.system.blogAdmin.bundary.controller;

import com.cnc.common.web.util.MessageBox;
import com.system.blogAdmin.bundary.service.MainIndexService;
import com.system.blogAdmin.bundary.entity.MainIndex;
import com.system.blogAdmin.bundary.service.MainIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 作者： cnc
 * 创建时间：2017-07-10.
 * 版本：1.0
 */
@Controller
@RequestMapping(value = "/bundary")
public class bundaryIndexController {

    @Autowired
    MainIndexService mainIndexService;

    @RequestMapping(value = "/index",method = RequestMethod.GET)
    public String index(){
        return "blogAdmin/bundary/index";
    }


    @RequestMapping(value = "/add",method = RequestMethod.POST,produces = "application/json;charset=utf-8;")
    @ResponseBody
    public MessageBox saveInfo(MainIndex mainIndex){
        mainIndexService.create(mainIndex);
        return MessageBox.getSuccessMsg("修改成功!");
    }

    @RequestMapping(value = "/getMaxInfo",method = RequestMethod.GET,produces = "application/json;charset=utf-8;")
    @ResponseBody
    public MainIndex getInfo(){
        return mainIndexService.getMaxInfo();
    }


}
